﻿@model Leads360Express.Repository.Pages.EmailOptOut.EmailOptOutModel
@{
    Layout = "~/Views/EmailSummary/_EmailSummaryLayout.cshtml";
    ViewBag.Title = "Email opt-out report";
}
<form action="#" class="form" id="emailOptOutReportModel">
    <fieldset>
        <div class="content">
            <div class="error-msg" id="visibleErrormsg" style="display:none; margin-top:-1px">
                <span>This information is currently not available because of a problem with the network or server.  Please try again in a few moments.</span>
            </div>

            <h2 class="app">
                <strong>Opt-Out Report</strong>
                @Html.Partial("_PatialLeads_Calls", @Model.LeadCall )
            </h2>

            <div class="title nomargin form">
                <!--<span class="right-btns">
                    <a href="@Url.Action("ExportToExcel")" class="btn btn-exportexcel">Export to Excel</a>
                </span>-->
                <h3 class="area">
                    <span class="spl">Filter:</span>
                    <input type="radio" class="radio spl" name="filter" value="true" data-bind="checked: FilterOption" />

                    <label for="startDate" class="spl" style="font-weight:normal;">From:</label>
                    <input type="text" id="startDate" value="@DateTime.Today.AddDays(-7).ToShortDateString()" class="text date spl" data-bind="enable: FromDateEnable" />

                    <label for="endDate" class="spl" style="font-weight:normal;padding-left:5px;">To:</label>
                    <input type="text" id="endDate" value="@DateTime.Today.ToShortDateString()" class="text date" data-bind="enable: ToDateEnable" />

                    <span class="spl" style="padding-left:5px;">or</span>
                    <input type="radio" class="radio spl" name="filter" value="false" data-bind="checked: FilterOption" />

                    <label for="txtSearchText" class="spl" style="font-weight: normal;">Search:</label>
                    <span id="SearchInput"><input type="text" class="text spl search filter" id="txtSearchText" data-bind="enable:SearchEnable, value:txtSearch, event: { keypress: RunSomethingKey }" /></span>
                    <a class="btn btn-go" href="javascript:void(1);" data-bind="click: search">Go</a>
                </h3>
            </div>

            <div data-bind="visible:!NoResultsFound()">
                <span class="paging">
                    <span class="show">Show <input type="text" class="text" id="pagesize" data-bind="value: PageSize" maxlength="3" onkeypress="return isNumberKey(event)" value="10" /> per page <span class="smallText" data-bind="text: PageSizeText"></span> </span>
                    <span class="pages"><span class="smallText" data-bind="text: PageCurrentText"></span>Page <input type="text" id="pageIndex" class="text" data-bind="value:CurrentPageIndex" /> of <label data-bind="text:MaxPageIndex"></label>
                        <a href="##" class="btn btn-prev-arrow" data-bind="click: PrevPage, attr: {'class': PrevButtonClass}"></a>
                        <a href="##" class="btn btn-next-arrow" data-bind="click: NextPage, attr: {'class': NextButtonClass}"></a>
                    </span>
                </span>

                <div class="table table-leads emailoptout">
                    <div class="title">
                        <div class="col1" data-bind="click: function(event) { SetOrder(event, 'Email') }">
                            <span class="w">
                                <a href="#">Email Address</a>
                                <div class="sort_wrapper" id="Email">
                                    <span class="grid_order ui_icon"></span>
                                </div>
                            </span>
                        </div>
                        <div class="col1 col2" data-bind="click: function(event) { SetOrder(event, 'OptOutDate') }">
                            <span class="w">
                                <a href="#">Opt-Out Date</a>
                                <div class="sort_wrapper" id="OptOutDate">
                                    <span class="grid_order ui_icon"></span>
                                </div>
                            </span>
                        </div>
                        <div class="col1 col12 centeralign"><span class="w">Find Leads</span></div>
                    </div>

                    <div data-bind="foreach: OptoutReport">
                        <div class="line" data-bind="attr:{'class': ($index() === ($parent.OptoutReport().length - 1))? 'line last': 'line'}">
                            <div class="col1"><span class="w"><label data-bind="text: Email"></label></span></div>
                            <div class="col1 col2"><span class="w"><label data-bind="text: OptOutDate"></label></span></div>
                            <div class="col1 col12 centeralign" data-bind="attr:{'class': ($index() === ($parent.OptoutReport().length - 1))? 'col1 col12 centeralign btm': 'col1 col12 centeralign'}">
                                <span class="w"><a class="btn btn-find" data-bind="attr: {href: '/Lead/SearchResult?Keyword=' + Email + '&amp;Field=email'}"></a></span></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="panel" data-bind="visible:NoResultsFound">
                <div class="error-msg"><span data-bind="text:NotFoundMessage"></span></div>
            </div>

            @Html.Partial("_Footer.Copyright")
        </div><!-- //.content -->
    </fieldset>
</form>

<script type="text/javascript">
//<![CDATA[
    $(function() {
        $("#startDate").datepicker();
        $("#endDate").datepicker();
    });

    var data = @(Html.Raw(Json.Encode(Model)));
//]]>
</script>
<script src="~/Scripts/viewModel/EmailOptOutReportViewModel.js" type="text/javascript"></script>
